#!/usr/bin/perl

use Test;
BEGIN { plan tests => 2}

$basedir = $0;  $basedir =~ s|(.*)/[^/]*|$1|;

# Start the target process.
if ( ($pid = fork()) == 0 ) {
	exec "runcon -t test_getsched_target_t $basedir/target";
}

sleep 1; # Give it a second to start

# Verify that test_getsched_yes_t can get the scheduling.
# SCHED_OTHER	0	priority must == 0
# SCHED_FIFO	1	priority 1..99
# SCHED_RR	2	priority 1..99
$result = system "runcon -t test_getsched_yes_t -- $basedir/source $pid 2>&1";
ok($result, 0); 

# Verify that test_getsched_no_t cannot get the scheduling.
$result = system "runcon -t test_getsched_no_t -- $basedir/source $pid 2>&1";
ok($result); 

# Kill the target
kill KILL, $pid;

exit;
